package net.yb.shop;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class HelloWorld {

    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver"); // 反射
            Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/yc12405", "root", "root");
            String sql = "delete from t_user where id=?";
            PreparedStatement ps = conn.prepareStatement(sql);
            ps.setInt(1, 3);
            ps.executeUpdate();
            System.out.println("删除成功！");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
